package com.gw.business.analysis.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.gw.business.analysis.model.UserTrackBasic;
import com.gw.business.analysis.model.UserTrackDataAttribution;
import com.gw.business.analysis.service.UserTrackDataAttributionService;
import com.gw.platform.service.impl.DefaultService;

@Service
public class UserTrackDataAttributionServiceImpl extends DefaultService implements UserTrackDataAttributionService {

	@Override
	public Boolean insert(UserTrackDataAttribution obj) {
		 try {
			 defaultDao.update("UserTrackDataAttirbu_insert", obj);
	        } catch (Exception e) {
	            return false;
	        }
	        return true;
	}

	@Override
	public void insertList(List<UserTrackDataAttribution> list) {
        if(list != null && list.size() > 0 )
		    defaultDao.insert("UserTrackDataAttribution.insert", list);
		
	}
	

	@Override
	public void updateList(List<UserTrackDataAttribution> list) {
		defaultDao.insert("UserTrackDataAttribution.bacthUpdate", list);;
		
	}

	@Override
	public Boolean update(UserTrackDataAttribution obj) {
		 try {
			 defaultDao.update("UserTrackDataAttirbu_update", obj);
	        } catch (Exception e) {
	            return false;
	        }
	        return true;
	}
	@Override
	public List<UserTrackDataAttribution> serList(String dataTime,
			String utmcsr, String utmcmd) {
		Map<String, Object> map = new HashMap<String, Object>();

		map.put("utmcsr", utmcsr);
		map.put("utmcmd", utmcmd);
		map.put("dataTime", dataTime);
		return (List<UserTrackDataAttribution>) defaultDao.find("UserTrackDataAttirbuList", map);
	}

	@Override
	public List<UserTrackDataAttribution> serAllList() {
		// TODO Auto-generated method stub
		return (List<UserTrackDataAttribution>) defaultDao.find("queryAttributionDataAll");
	}

    @Override
    public void batchUpdateList(List<UserTrackDataAttribution> list){
        if(list != null && list.size() > 0 )
            defaultDao.update("UserTrackDataAttribution.batchUpdateById", list);
    }
}
